﻿using GIMS.Def.Arguments;
using GIMS.Def.Operators;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Drawing;
using GIMS.Def.Settings;

namespace GIMS.Def.Test
{
    /// <summary>
    ///This is a test class for AppendOperatorTest and is intended
    ///to contain all AppendOperatorTest Unit Tests
    ///</summary>
    [TestClass()]
    public class AppendOperatorTest
    {
        /// <summary>
        /// Reset GlobalSettings
        /// </summary>
        [TestInitialize()]
        public void MyTestInitialize()
        {
            GlobalSettings_Accessor.instance = null;
        }

        /// <summary>
        ///A test for CreateScriptPart - Append Operator with gravity and background Setting
        ///</summary>
        [TestMethod()]
        public void CreateScriptPartTest()
        {
            AppendOperator_Accessor target = new AppendOperator_Accessor(); 
            target.backgroundSetting.Active = true;
            ColorArgument arg1 = (ColorArgument)target.backgroundSetting.Argument;
            arg1.Color = Color.Red;
            target.gravitySetting.Active = true;
            GravityArgument arg2 = (GravityArgument) target.gravitySetting.Argument;
            arg2.Gravity = Gravity.east;
            string actual;
            actual = target.CreateScriptPart();
            Assert.AreEqual("-gravity east -background rgba(255,0,0,1) -append", actual);
        }

        /// <summary>
        ///A test for CreateScriptPart - Append Operator, horizontal append Argument, with Settings
        ///</summary>
        [TestMethod()]
        public void CreateScriptPartTest2()
        {
            AppendOperator_Accessor target = new AppendOperator_Accessor();
            AppendArgument arg=(AppendArgument)target.Argument;
            arg.AppendDirection=AppendDirection.horizontal;
            target.backgroundSetting.Active = true;
            ColorArgument arg1 = (ColorArgument)target.backgroundSetting.Argument;
            arg1.Color = Color.Red;
            target.gravitySetting.Active = true;
            GravityArgument arg2 = (GravityArgument)target.gravitySetting.Argument;
            arg2.Gravity = Gravity.east;
            string actual;
            actual = target.CreateScriptPart();
            Assert.AreEqual("-gravity east -background rgba(255,0,0,1) +append", actual);
        }
    }
}
